<template>
  <div class="FoodFastFood">
    <fast-food-header/>
    <fast-food-logo/>
    <fast-food-recommend :list="fastFoodRecommendList "/>
    <fast-food-footer/>
  </div>
</template>

<script>
import FastFoodHeader from "./components/FastFoodHeader.vue";
import FastFoodLogo from "./components/FastFoodLogo.vue";
import FastFoodRecommend from "./components/FastFoodRecommend.vue";
import FastFoodFooter from "./components/FastFoodFooter.vue";
import axios from "axios";
export default {
  name: "FoodFastFood",
  components: {
    FastFoodHeader,
    FastFoodLogo,
    FastFoodRecommend,
    FastFoodFooter
  },
  data: function() {
    return {
      fastFoodRecommendList: []
    };
  },
  mounted() {
    this.getHomeApiInfo();
  },
  methods: {
    getHomeApiInfo() {
      axios
        .get("/mock/Food/fastFood.json")
        .then(this.getHomeResponseInfo, function(success) {
          console.log("请求json数据成功");
          console.log(success);
        })
        .catch(function(err) {
          console.log("请求json数据失败");
          console.log(err);
        });
    },
    getHomeResponseInfo(response) {
      console.log(response.data);
      let res = response.data;
      if (res.success && res.dataList) {
        const fastFoodData = res.dataList;
        this.fastFoodRecommendList = fastFoodData.FastFoodRecommedLists;
      }
    }
  }
};
</script>          